﻿@model SubjectSortModel
@{
    CssLink.Add("~/Content/css/subjectSort.css");
}

<h1>@Model.주제.총제목</h1>
<hr />

<h2>목차 순서변경</h2>

<table border="0" id="목차순서변경" class="table">
    <thead>
        <tr>
            <th></th>
            <th>제목</th>
            <th>작성자</th>
            <th>작성일</th>
        </tr>
    </thead>
    <tbody id="목차" class="sortable">
        @foreach(var 글 in Model.글목록) {
            <tr class="ui-state-default" id="@글.ID">
                <td><span class="ui-icon ui-icon-arrowthick-2-n-s"></span></td>
                <td>@글.제목</td>
                <td>@글.작성자</td>
                <td>@글.생성일.ToYMDHM()</td>
            </tr>
        }
    </tbody>
</table>
<hr />

<form>
    <div class="controls">
        @Html.HiddenFor(m => m.목차순서)
        @Html.HiddenFor(m => m.주제.ID)
        <a onclick="목차순서저장(@Model.주제.ID, $('#목차').sortable('toArray').join(','))" class="btn btn-primary">저장</a>
        <a href="@Url.SubjectDetail(Model.주제.ID)" class="btn">취소</a>
    </div>
</form>

<script type="text/javascript">
    $(document).ready(function () {
        $(".sortable").sortable();
    })
</script>
